import request from '@/utils/requset'

export interface sortData{
    categoryGroupList:categoryListData[]
    categoryL1List:sortCategory[]
    categoryL2List:category2Data[]
    currentCategory:sortImg
}

export interface categoryListData{
    categoryList:categoryData[]
    id:string,
    name:string,
 
}
export interface categoryData{
    id:string,
    name:string,
    wapBannerUrl:string,

}


export interface sortCategory{
    id:number,
    name:string,
}
export interface sortImg{
    id?:number,
    name?:string,
    bannerList:sortBannerList[],
    bannerUrl:string
}

export interface sortBannerList{
    picUrl:string,
    id:number
}

export interface category2Data{
    bannerUrl:string
    id:number
    name:string,
    wapBannerUrl:string,
    superCategoryId:number,
    categoryType:number
}
export interface categoryList2{
    name:string,
    id:number,
    wapBannerUrl:string
}

export interface categoryData {
    categoryItems:{
        category:{
            frontName:string,
            id:number
        },
        itemList:itemData[]
    },
    categoryL2List:category2Value[]

}
export interface itemData{
    id:number,
    name:string,
    listPicUrl:string,
    topLogo:{
        logoUrl:string
    }
}
export interface category2Value{
    name:string,
    id:number
}
export const reqSortList = ()=>{
    return request.get<any,sortData>('item/cateList.json')
}

export const reqSortListId = (categoryId:number)=>{
    return request.get<any,sortData>(`item/cateList.json?__timestamp=1630131455012&categoryId=${categoryId}`)
}

export const reqSortDataList =(categoryId:number,subCategoryId:number,categoryType:number)=>{
    return request.get<any,categoryData>(`item/list.json?__timestamp=1673329860232&categoryId=${categoryId}&subCategoryId=${subCategoryId}&categoryType=${categoryType}`)
}